<?php 
  header("Content-type:application/json");
  include("../conn/conn.php");
  
  $json=file_get_contents("php://input");
  $arr=json_decode($json,true);
  $code=$arr['code'];
  $sql="SELECT id from grad_select where code='$code'";
  $r=mysqli_query($link,$sql);
  if(mysqli_num_rows($r)>0){
    $arr=array(
      'code'=>201,
      'msg'=>'已经选课'
    );
  }else{
    $arr=array(
      'code'=>200,
      'msg'=>'未选课'
    );
  }
  echo json_encode($arr,true);
